﻿using System;
using System.Collections.Generic;
using System.Text;

using libReadWrite;
using libCommonClass;

namespace TTServer.Messages
{
    class RSAPublicKeyServerMessage : TTMessage
    {
        public byte[] modulus;
        public byte[] exponent;

        public RSAPublicKeyServerMessage(byte[] modulus, byte[] exponent)
        {
            this.modulus = modulus;
            this.exponent = exponent;
        }

        public RSAPublicKeyServerMessage()
        {
            // TODO: Complete member initialization
        }

        public override void ReadMessage(BigEndianReader sr)
        {
            throw new NotImplementedException();
        }

        public override void WriteMessage(BigEndianWriter sw)
        {
            sw.Write((byte)MessageKind.RSA_PUBLIC_KEY_SERVER);

            sw.Write(Global.NO_LENGTH_CODE);

            sw.WriteByteArray(modulus);

            sw.WriteByteArray(exponent);
        }

        public override TTMessage Clone()
        {
            return new RSAPublicKeyServerMessage();
        }

        public override int GetMessageID()
        {
            return MessageKind.RSA_PUBLIC_KEY_SERVER;
        }

        public override string GetMessageName()
        {
            return "RSAPublicKeyServer";
        }
    }
}
